package com.foosun.core.util.filecore;

/**
 * Created by xi on 14-4-16.
 */

import org.apache.commons.fileupload.ProgressListener;

import javax.servlet.http.HttpSession;

public class PJProgressListener implements ProgressListener {
    private HttpSession session;


    public PJProgressListener() {
    }

    public PJProgressListener(HttpSession _session) {
        session = _session;
        ProgressEntity ps = new ProgressEntity();
        session.setAttribute(ProgressEntity.PS_NAME, ps);
    }

    public void update(long pBytesRead, long pContentLength, int pItems) {
        ProgressEntity ps = (ProgressEntity) session.getAttribute(ProgressEntity.PS_NAME);
        ps.setpBytesRead(pBytesRead);
        ps.setpContentLength(pContentLength);
        ps.setpItems(pItems);
        //更新
        session.setAttribute(ProgressEntity.PS_NAME, ps);
    }

}

